const express=require('express')
const fs=require('fs')

const path=require('path')

const app= express()

// let str=1
// fs.readFile(path.resolve(__dirname,'./json/nav.json'),(err,data)=>{
//     console.log('2');
//     if(err)  throw new Error(err)
//       str=data.toString()
// })

 let data1= fs.readFileSync(path.resolve(__dirname,'./json/nav.json'))

 let data2= fs.readFileSync(path.resolve(__dirname,'./json/news.json'))



app.get('/api/home',(req,res)=>{
    console.log('1');
    res.send(data1)
})
app.get('/api/news',(req,res)=>{
   
    res.send(data2)
})




app.listen(3000,()=>{
    console.log('3000 端口  running');
})